package com.wang.kmp.shared.data.base

import kotlinx.serialization.Serializable

interface IResp {
    val code: Int
    val message: String
    val error: String
}

@Serializable
class BaseResp(override val code: Int = -1, override val message: String = "", override val error: String = "") : IResp {
    companion object {
        const val CODE_SUCCESS = 20000

        //负数为框架层错误码，正数为业务层错误码

        const val CODE_FAIL = -2

        //参数不正确
        const val CODE_PARAMETER_FAIL = -3
    }
}

@Serializable
class BaseTypeResp<T>(override val code: Int = -1, override val message: String = "", override val error: String = "", val data: T? = null) : IResp